package com.glebusheg.app
{
	import com.glebusheg.asset.AssetManager;
	import com.glebusheg.ui.Accordion;
	import com.glebusheg.data.MarketData;
	
	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	/**
	 * ...
	 * @author Gleb Volkov
	 */
	public class SuitApp extends Sprite
	{
		private var _accordion:Accordion;
		
		public function SuitApp() 
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event = null):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			// entry point
			tabChildren = false;
			mouseEnabled = false;
			
			var data:MarketData = MarketData.getMarket("dress");
			var panels:int = data.tabs.length;
			
			_accordion = new Accordion(200, 300, panels, 20);
			for (var i:int = 0; i < panels; i++) 
			{
				_accordion.addPanel(data.tabs[i]);
			}
			addChild(_accordion);
			
			_accordion.reset();
			
			//stage.addEventListener(MouseEvent.MOUSE_DOWN, onStageMouseDown);
		}
		
/*		private function onStageMouseDown(e:MouseEvent):void 
		{
			if (_accordion)
			{
				_accordion.destroy();
				removeChild(_accordion);
				_accordion = null;
			}
		}*/
		
	}

}